<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>代理佣金结算</title>
    <script src="http://www.jq22.com/jquery/jquery-1.9.1.js"></script>
</head>
<body>
<div id="time"><button onclick="jiesuan()">结算</button></div>
<div id="afterjiesuan" style="display: none">
	<button onclick="down1()">下载一级代理财务总表</button>
	<button onclick="down2()">下载一级代理记录表</button>
	<button onclick="down3()">下载二级代理财务总表</button>
	<button onclick="down4()">下载二级代理记录表</button>
</div>

</body>


<script>

	$(function () {
		var url="http://wifi.qianlh.com/Admin/Adminapi/gettime";
		//var url="http://www.mifi.com/index.php/Admin/Adminapi/gettime";
		$.ajax({
			type:'get',
			url:url,
			success:function(data){
				data=JSON.parse(data);
				$str=data.firstday+'至'+data.lastday;
				$("#time").prepend($str);
			},
			error:function () {
			}
		});
	});

    function  jiesuan() {    	
    	var url="http://wifi.qianlh.com";
    	//var url="http://www.mifi.com/index.php";
    	var url1=url+"/Admin/Adminapi/doSettlement";
		$.ajax({
			type:'get',
			url:url1,
			success:function(){
				alert('结算成功');
				$("#afterjiesuan").attr('style','display:block');
			},
			error:function () {
				alert("请求失败了");
			}
		});
	}

	function  down1() {    	
    	var url="http://wifi.qianlh.com";
    	//var url="http://www.mifi.com/index.php";
    	var url1=url+"/Admin/Adminapi/exportGeneralLedger";
    	window.location.href=url1;
		
	}

	function  down2() {    	
    	var url="http://wifi.qianlh.com";
    	//var url="http://www.mifi.com/index.php";
    	var url1=url+"/Admin/Adminapi/exportEveryoneList";
		window.location.href=url1;
	}

	function  down3() {    	
    	var url="http://wifi.qianlh.com";
    	//var url="http://www.mifi.com/index.php";
    	var url1=url+"/Admin/Adminapi/exportTwoGeneralLedger";
    	window.location.href=url1;
		
	}

	function  down4() {    	
    	var url="http://wifi.qianlh.com";
    	//var url="http://www.mifi.com/index.php";
    	var url1=url+"/Admin/Adminapi/exportTwoEveryoneList";
		window.location.href=url1;
	}






</script>


</html>